﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace PedesTrainProject.Data
{
    [Serializable()]
    public class Statistics : ISerializable
    {
        private List<Traffic.Jam> jams;

        private int carTotal;

        public int CarTotal
        {
            get { return carTotal; }
            set { carTotal = value; }
        }

        private int jamTotal;

        public int JamTotal
        {
            get { return jamTotal; }
            set { jamTotal = value; }
        }

        private DateTime startTime;

        public DateTime StartTime
        {
            get { return startTime; }
            set { startTime = value; }
        }
        private DateTime endTime;

        public DateTime EndTime
        {
            get { return endTime; }
            set { endTime = value; }
        }

        public Statistics()
        {
            jams = new List<Traffic.Jam>();
        }

        private void calculateJams()
        {

        }

        private void calculateLoad()
        {

        }

        public void update()
        {

        }

        #region Serializable

        public Statistics(SerializationInfo info, StreamingContext ctxt)
        {
            this.carTotal = (int)info.GetValue("CarTotal", typeof(int));
            this.jamTotal = (int)info.GetValue("JamTotal", typeof(int));
            this.StartTime = (DateTime)info.GetValue("StartTime", typeof(DateTime));
            this.EndTime = (DateTime)info.GetValue("EndTime", typeof(DateTime));
        }

        public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
        {
            info.AddValue("CarTotal", this.carTotal);
            info.AddValue("JamTotal", this.jamTotal);
            info.AddValue("StartTime", this.startTime);
            info.AddValue("EndTime", this.endTime);
        }

        #endregion
    }
}
